
<div>

<style type="text/css">
    
    .input-group-addon, .input-group-btn {
        width: initial;
    }

    .type .form-control, 
    .stock .form-control {
        height: 30px;
    }
</style>


<div class="panel panel-default mt10">
<div class="panel-body">
<div class="col-sm-12">

    <div class="row ">

        <div class="col-sm-2">
            <input type="text" class="form-control"  ng-model="searchform.name" placeholder="产品名称"> 
        </div>
        <div class="col-sm-2">
            <input type="text" class="form-control" ng-model="searchform.code" 
            placeholder="产品编号">
        </div>

        <div class="col-sm-2 col-sm-offset-6">
            <button class="btn btn-block btn-info"
            ng-click="load()"
            >搜索</button> 
        </div>

    </div>

</div>
</div>
</div>
<!-- searchArea -->
<div ng-repeat="obj in objs" class="col-sm-12" 
style="border-bottom: 1px solid #eee; margin-left: 0px;"
>        
    <div class="row">
    <div class="col-sm-12 mt15">
        <div class="col-sm-3 text-right">
            <img ng-src="{{obj.toppic}}" class="img-thumbnail" 
            style="width: 150px; height: 150px;">
        </div>
        <div class="col-sm-9 ">

            <div class="row">
                <div class="lh2" 
                style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
                       width: 100%;  float: left;"
                ng-if="obj.opt.name == '0'"
                >
                    [ {{obj.code}} ] 
                    <span ng-click="changeOpt(obj,'name')"
                    style="cursor: pointer;" 
                     class="h4" style="color: #31708f;">{{obj.name}}</span>
                </div>
            </div>

            <div class="input-group" 
            style="width: 400px; margin-bottom: 10px;" 
            ng-if="obj.opt.name == '1'">
              <input type="text" class="form-control" 
              ng-model="obj.name"
              >
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="setName(obj)"
                >OK</button>
              </span>
            </div>

            <!-- <div class="lh2 row">
                {{obj.view_name}} &nbsp; | &nbsp; 
                有效期：<span class="text-danger">
                    {{obj.t_period}}
                </span>
            </div> -->

            <!-- <div class="lh2 row">
                <span ng-if="obj.cost_price == 999999 && obj.guide_price == 999999">
                购买价格：<span style="color: red; font-weight: 700;">免费</span>
                </span>
                <span ng-if="obj.cost_price != 999999 || obj.guide_price != 999999">
                成本价格：
                <span style="color: red; font-weight: 700;">{{obj.cost_price | currency : '￥'}}</span> &nbsp; | &nbsp;
                购买价格：
                <span style="color: red; font-weight: 700;">{{obj.guide_price | currency : '￥'}}</span>
                </span>

                 &nbsp; | &nbsp; 
                门市价格：
                <span style="color: red; font-weight: 700;">{{obj.market_price | currency : '￥'}}</span>
            </div> -->

            <!-- <div class="lh2">
                群盟分销体系 &nbsp; | &nbsp; 
                一级佣金：<span style="color: red; font-weight: 700;">{{obj.cost_price | currency : '￥'}}</span> &nbsp; | &nbsp; 
                二级佣金：<span style="color: red; font-weight: 700;">{{obj.cost_price | currency : '￥'}}</span> 
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span style="cursor: pointer;" 
                data-toggle="collapse" href="#collapseExample{{$index}}" 
                >更多<span class="caret"></span></span>

                <div class="collapse" id="collapseExample{{$index}}">
                  <div class="well">
                    adasdasdadsadsadsasdadsadsads
                  </div>
                </div>
            </div> -->

            <!-- <div class="lh2 row">
                <div class="fl">{{obj.product_typename}} &nbsp; | &nbsp; </div>

                <div style="cursor: pointer; float: left;"
                ng-if="obj.opt.back_type == '0'"
                ng-click="changeOpt(obj,'back_type')"
                >
                    <div class="fl">{{obj.back_type_label}} </div>
                </div>

                <div 
                ng-if="obj.opt.back_type == '1'"
                >
                    <div class="fl"><strong>允许退票：</strong></div>

                    <label class="i-switch m-t-xs m-r fl">
                        <input type="checkbox" 
                          ng-checked="obj.back_type == '0'"
                          name="back_type"
                          ng-true-value="'0'"
                          ng-false-value="'1'"
                          ng-model="obj.back_type"
                        >
                        <i></i>
                    </label>

                    <button type="button" class="btn btn-default btn-sm fl ml10"
                    ng-click="setBackType(obj)"
                    >
                    OK
                    </button>

                </div> -->

                <!-- <div class="fl">对接票付通 &nbsp; | &nbsp; </div> -->

                <!-- <div style="cursor: pointer; display: inline-flex;"
                ng-if="obj.opt.integral == '0'"
                ng-click="changeOpt(obj,'integral')"
                >
                送 {{obj.integral_num}} 积分
                </div> -->

                <!-- <div 
                ng-if="obj.opt.integral == '1'"
                >
                送 
                <div class="input-group input-group-sm"
                style="display: inline-flex; width: 90px; margin: 0 5px;" 
                >
                  <input type="text" class="form-control" 
                  ng-model="obj.integral_num"
                  >
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button"
                    ng-click="setIntegral(obj)"
                    >OK</button>
                  </span>
                </div>
                积分
                </div> -->
                
            <!-- </div> -->

            <div class="lh2 row">
                <div style="cursor: pointer; float: left;"
                ng-if="obj.opt.sms == '0'"
                ng-click="changeOpt(obj,'sms')"
                >
                    <div class="fl"><strong>短信配置：</strong></div>
                    <div class="fl"
                    ng-if="obj.sms_type == '0'"
                    >不发短信</div>
                    <div class="fl" 
                    ng-if="obj.sms_type == '1'"
                    style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
                    width: 300px;">
                    {{obj.sms_diy}}
                    </div>
                </div>

                <div 
                ng-if="obj.opt.sms == '1'"
                >
                    <div class="fl"><strong>短信配置：</strong></div>
                    <label class="i-switch m-t-xs m-r fl">
                        <input type="checkbox" 
                          ng-checked="obj.sms_type == '1'"
                          name="sms_type"
                          ng-true-value="'1'"
                          ng-false-value="'0'"
                          ng-model="obj.sms_type"
                        >
                        <i></i>
                    </label>

                    <button type="button" class="btn btn-default btn-sm fl ml10"
                    ng-click="setSms(obj)"
                    >
                    OK
                    </button>

                    <textarea class="form-control" rows="3"
                      ng-model="obj.sms_diy"
                      ></textarea>

                </div>


            </div>


            <div class="lh2 row">
                <div style="cursor: pointer; float: left;"
                ng-if="obj.opt.flash == '0'"
                ng-click="changeOpt(obj,'flash')"
                >
                    <strong>购买时间：</strong>
                    <span ng-if="obj.flash_state == '0'">不限制</span>
                    <span ng-if="obj.flash_state == '1'">
                        {{obj.start_time}} 至 {{obj.end_time}}
                    </span>
                </div>

                <div 
                ng-if="obj.opt.flash == '1'"
                >
                    <div class="fl"><strong>购买时间：</strong></div>

                    <label class="i-switch m-t-xs m-r fl">
                        <input type="checkbox" 
                          ng-checked="obj.flash_state == '1'"
                          name="flash_state"
                          ng-true-value="'1'"
                          ng-false-value="'0'"
                          ng-model="obj.flash_state"
                        >
                        <i></i>
                    </label>

                    <div ng-show="obj.flash_state == '1'">
                        <input class=" fl" datetimepicker readonly
                        ng-model="obj.start_time_date" 
                        options="vm.options"
                        style="border: none; width: 110px; border-bottom: 1px solid #aaa;"
                        />
                        <div class="fl"> 至 </div>
                        <input class=" fl ml10" datetimepicker readonly
                        ng-model="obj.end_time_date" 
                        options="vm.options"
                        style="border: none; width: 110px; border-bottom: 1px solid #aaa;"
                        />
                    </div>

                    <button type="button" class="btn btn-default btn-sm fl ml10"
                    ng-click="setFlash(obj)"
                    >
                    OK
                    </button>

                </div>
                
            </div>

            <div class="lh2 row">
            
                <div style="cursor: pointer; float: left;"
                ng-if="obj.opt.tour == '0'"
                ng-click="changeOpt(obj,'tour')"
                >
                <strong>出游时间：</strong>
                <span ng-if="obj.tour_date_type == '0'">不限制</span>
                <span ng-if="obj.tour_date_type == '1'">
                    {{obj.tour_date_limit_start}} 至 {{obj.tour_date_limit_end}}
                </span>

                </div>

                <div 
                ng-if="obj.opt.tour == '1'"
                >
                    <div class="fl"><strong>出游时间：</strong></div>

                    <label class="i-switch m-t-xs m-r fl">
                        <input type="checkbox" 
                          ng-checked="obj.tour_date_type == '1'"
                          name="tour_date_type"
                          ng-true-value="'1'"
                          ng-false-value="'0'"
                          ng-model="obj.tour_date_type"
                        >
                        <i></i>
                    </label>

                    <div ng-show="obj.tour_date_type == '1'">
                        <input class=" fl" datetimepicker readonly
                        ng-model="obj.tour_date_limit_start_date" 
                        options="vm1.options"
                        style="border: none; width: 110px; border-bottom: 1px solid #aaa;"
                        />
                        <div class="fl"> 至 </div>
                        <input class=" fl ml10" datetimepicker readonly
                        ng-model="obj.tour_date_limit_end_date" 
                        options="vm1.options"
                        style="border: none; width: 110px; border-bottom: 1px solid #aaa;"
                        />
                    </div>


                    <button type="button" class="btn btn-default btn-sm fl ml10"
                    ng-click="setTour(obj)"
                    >
                    OK
                    </button>
                </div>
            </div>


            <!-- 分类和栏目 -->
            <div class="lh2 row type">
                <div style="cursor: pointer; float: left;"
                ng-if="obj.opt.type == '0'"
                ng-click="changeOpt(obj,'type')"
                >
                <strong>分类设置：</strong>{{obj.type_label}} &nbsp; | &nbsp; 
                <strong>栏目设置：</strong>{{obj.column_label}}
                </div>

                <div 
                ng-if="obj.opt.type == '1'"
                >
                <div class="fl"><strong>分类设置：</strong></div>
                <div class="input-group input-group-sm fl" >
                  <ui-select ng-model="obj.type_code" theme="bootstrap"  >
                    <ui-select-match placeholder="分类">
                        {{$select.selected.type_name}}
                    </ui-select-match>
                    <ui-select-choices repeat="item.type_code as item in label.typelist | filter: $select.search">
                        <span ng-bind-html="item.type_name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button"
                    ng-click="setType(obj)"
                    >OK</button>
                  </span>
                </div>
                <div class="fl">&nbsp; | &nbsp; 
                <strong>栏目设置：</strong></div>
                <div class="input-group input-group-sm fl" >
                  <ui-select ng-model="obj.column_code" theme="bootstrap"  >
                    <ui-select-match placeholder="栏目">
                        {{$select.selected.column_name}}
                    </ui-select-match>
                    <ui-select-choices repeat="item.column_code as item in label.columnlist | filter: $select.search">
                        <span ng-bind-html="item.column_name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button"
                    ng-click="setColumn(obj)"
                    >OK</button>
                  </span>
                </div>
                </div>
            </div>
            <!-- 分类和栏目 -->
        </div>

    </div>
    <!-- <div class="col-sm-5 mt15"> -->
        

        <!-- 库存和生效时间 -->
        <!-- <div class="lh2 row stock">
            <div style="cursor: pointer; float: left;"
            ng-if="obj.opt.stock == '0'"
            ng-click="changeOpt(obj,'stock')"
            >
                <strong>库存数量：</strong>
                <span ng-if="obj.stock_type == '0'">不限制</span>
                <span ng-if="obj.stock_type == '1'" class="text-danger">
                    {{obj.current_stock_num}}
                </span>
                &nbsp; | &nbsp; 
                <strong>生效时间：</strong>
                <span ng-if="obj.take_effect_type == -1"> 次日生效 </span>
                <span ng-if="obj.take_effect_type == 0"> 即时生效 </span>
                <span ng-if="obj.take_effect_type != -1 && obj.take_effect_type != 0 "> {{obj.take_effect_type}} 小时后生效 </span>
            </div>

            <div 
            ng-if="obj.opt.stock == '1'"
            >
                <div class="fl"><strong>库存数量：</strong></div>
                <label class="i-switch m-t-xs m-r fl">
                    <input type="checkbox" 
                      ng-checked="obj.stock_type == '1'"
                      name="stock_type"
                      ng-true-value="'1'"
                      ng-false-value="'0'"
                      ng-model="obj.stock_type"
                    >
                    <i></i>
                </label>
                <input type="text" class="fl" 
                  style="border: none; width: 50px; border-bottom: 1px solid #aaa;"
                  ng-show="obj.stock_type == '1'"
                  ng-model="obj.current_stock_num" 
                  value="{{obj.current_stock_num}}">

                <button type="button" class="btn btn-default btn-sm fl ml10"
                ng-click="setStock(obj)"
                >
                OK
                </button>


                <div class="fl">&nbsp; | &nbsp; 
                <strong>生效时间：</strong></div>
                <div class="input-group input-group-sm fl" 
                style="width: 130px; display: inline-flex;">
                  <ui-select ng-model="obj.take_effect_type" theme="bootstrap"  >
                    <ui-select-match >
                        {{$select.selected.name}}
                    </ui-select-match>
                    <ui-select-choices repeat="item.code as item in label.take_effect_type_array | filter: $select.search">
                        <span ng-bind-html="item.name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button"
                    ng-click="setTakeEffectType(obj)"
                    >OK</button>
                  </span>
                </div>
            </div>
        </div> -->
        <!-- 库存和生效时间 -->
       

        <!-- <div class="lh2 row ">
            <strong>购买限制：</strong>
            {{obj.order_num_state_label}}
            <span ng-if="obj.order_num_state != 0">
             , 每个 {{obj.order_limit_type_label}} 
             限制购买 {{obj.order_limit_num}} 张
            </span>
        </div> -->


        

        
    <!-- </div> -->
    </div>

    <div class="row">
    <div class="col-sm-12 mb10">
        <div class="fl pt5" ng-if="obj.state == '2'">
            <div 
            ng-if="obj.unavailableReasons == ''"
            class="green">可以上架</div>
            <div 
            ng-if="obj.unavailableReasons != ''"
            class="red"><strong>不能上架原因：</strong>{{obj.unavailableReasons}}</div>
        </div>
       <!--  <div class="row"> -->
        <!-- <div class="col-sm-4"> -->
        <!-- /input-group -->
        <!-- </div>
        <div class="col-sm-8"> -->
        <div class="fr">
        <button type="button" class="btn btn-danger btn-xs"
        ng-if="obj.cancel_flag == '1'"
        ng-click="cancel(obj)"
        >
            <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 取消
        </button>

        <button type="button" class="btn btn-success btn-xs"
        ng-if="obj.myproduct != '1'"
        ng-click="edit(obj)"
        >
            <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑
        </button>

<!--         <button type="button" class="btn btn-info btn-xs"
        ng-click="setPoster(obj)"
        >
            <span class="glyphicon glyphicon-gift" aria-hidden="true"></span> 商城设置
        </button> -->

        <button type="button" class="btn btn-primary btn-xs"
        ng-if="obj.state == '1' && obj.myproduct != '1'"
        ng-click="release(obj)"
        >
            <span class="glyphicon glyphicon-tower" aria-hidden="true"></span> 发布到群盟
        </button>
        <button type="button" class="btn btn-info btn-xs"
        ng-if="obj.myproduct != '1'"
        ng-click="setPoster(obj)"
        >
            <span class="glyphicon glyphicon-gift" aria-hidden="true"></span> 海报
        </button>
        <button type="button" class="btn btn-warning btn-xs"
        ng-click="commission(obj)"
        >
            <span class="glyphicon glyphicon-usd" aria-hidden="true"></span> 佣金
        </button>

<!--         <button type="button" class="btn btn-info btn-xs"

        >
            <span class="glyphicon glyphicon-usd" aria-hidden="true"></span> 购买限制
        </button> -->

        <button type="button" class="btn btn-success btn-xs"
        ng-if="obj.state == '2'"
        ng-click="up(obj)"
        ng-disabled="obj.unavailableReasons != ''" 
        >
            <span class="glyphicon glyphicon-open" aria-hidden="true"></span> 上架
        </button>

        <button type="button" class="btn btn-success btn-xs"
        ng-if="obj.state == '1'"
        ng-click="down(obj)"
        >
            <span class="glyphicon glyphicon-save" aria-hidden="true"></span> 下架
        </button>

        
        <button type="button" class="btn btn-danger btn-xs"
        ng-if="obj.state == '2'"
        ng-click="delete(obj)"
        >
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> 删除
        </button>
        </div>
        <!-- </div> -->

        <!-- <div class="input-group input-group-sm fl" style="width: 150px;">
          <input type="text" class="form-control" ng-model="obj.asort" 
          value="{{obj.asort}}">
          <span class="input-group-btn">
            <button class="btn btn-default" type="button"
            ng-click="asort(obj)"
            >排序</button>
          </span>
        </div> -->

    </div>
    </div>
</div>
    <div class="text-right mt10">
         <pagination total-items="bigTotalItems" ng-model="bigCurrentPage" ng-change="load()" previous-text="上一页" next-text="下一页"
            first-text="首页" last-text="尾页" max-size="maxSize" boundary-links="true" rotate="false" items-per-page="itemsPerPage"
            class="m-t-none m-b">
        </pagination>
    </div> 
</div>   